<ul>
  <li>
    <div class="collapse-row">
      <i class="sn-icon sn-icon-down" data-toggle="collapse" href="#fluicsInstructionsSection" aria-expanded="false"></i>
      <div class="row-title"><%= t("users.settings.account.label_printer.instructions") %></div>
    </div>
    <ul class="collapse in collapse-content" id="fluicsInstructionsSection">
      <li>
        <%= t("users.settings.account.label_printer.fluics_instruction.p1") %>
      </li>
      <li>
        <%= t("users.settings.account.label_printer.fluics_instruction.p2_html", link: Constants::SCINOTE_FLUICS_URL) %>
      </li>
      <li>
        <%= t("users.settings.account.label_printer.fluics_instruction.p3") %>
      </li>
      <li>
        <%= t("users.settings.account.label_printer.fluics_instruction.p4") %>
      </li>
      <li>
        <%= t("users.settings.account.label_printer.fluics_instruction.p5") %>
      </li>
    </ul>
  </li>
<% if can_manage_label_printers? %>
  <li>
    <div class="collapse-row">
      <i class="sn-icon sn-icon-down" data-toggle="collapse" href="#SettingsSection" aria-expanded="false"></i>
      <div class="row-title"><%= t("users.settings.account.label_printer.settings") %></div>
    </div>
    <ul class="collapse in collapse-content" id="SettingsSection">
      <%= form_with scope: :label_printer, url: create_fluics_label_printers_path do |form| %>
        <div class="api-key-container" data-warning="<%= t("users.settings.account.label_printer.api_key_warning") %>">
          <div class="sci-input-container <%= 'error' if flash[:error] %>" data-error-text="<%= flash[:error] %>">
            <%= form.label :fluics_api_key, t("users.settings.account.label_printer.api_key_label") %>

            <%= form.text_field :fluics_api_key, class: "sci-input-field api-key-input", value: @fluics_api_key, data: {original_value: @fluics_api_key, } %>
          </div>

          <%= form.submit t('general.save'), class: "save-button btn btn-primary #{'hidden' if @fluics_api_key}" %>
          <%= button_tag class: "saved-button btn btn-secondary #{'hidden' if !@fluics_api_key}", disabled: true do %>
            <i class="sn-icon sn-icon-check"></i>
            <%= t("users.settings.account.label_printer.saved") %>
          <% end %>
        </div>
      <% end %>
    </ul>
  </li>
<% end %>
  <li>
    <div class="collapse-row">
      <i class="sn-icon sn-icon-down" data-toggle="collapse" href="#PrintersSection" aria-expanded="false"></i>
      <div class="row-title">Printers</div>
      <% if can_manage_label_printers? %>
        <div class="update-printers">
          <%= form_with scope: :label_printer, url: create_fluics_label_printers_path do |form| %>
            <%= form.hidden_field :fluics_api_key, value: @fluics_api_key %>
            <%= button_tag type: 'submit', class: "btn btn-light", disabled: @fluics_api_key.blank? do %>
              <i class="fas fa-sync"></i>
              <%= t("users.settings.account.label_printer.update_printers") %>
            <% end %>
          <% end %>
        </div>
      <% end %>
    </div>
    <ul class="collapse in collapse-content" id="PrintersSection">
      <% if @label_printers.any? %>
        <% @label_printers.each do |printer| %>
          <li>
            <b><%= printer.name %></b> • <%= printer.description %>
          </li>
        <% end %>
      <% else %>
        <li>
          <%= t("users.settings.account.label_printer.no_printers_available") %>
        </li>
      <% end %>
    </ul>
  </li>
</ul>
